package com.xgame.server.dbtool;

import com.xgame.server.db.mapper.AccountillegalMapper;
import com.xgame.server.db.model.Accountillegal;
import com.xgame.server.netty.proto.Game;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.text.SimpleDateFormat;

@Component
public class AccountillegalCsTool {
    @Resource
    private AccountillegalMapper accountillegalMapper;

    //插入玩家记录
    public Integer insertAccountRecord(Game.AccountDataCS data) throws Exception {
        Integer result = new Integer(0);

        Accountillegal account = new Accountillegal();
        account.setAccount(data.getAccount());
        account.setPlayerId(data.getPlayerID());
        account.setRoleName(data.getRoleName());
        account.setLevel(data.getLevel());
        account.setExp(new Long(data.getExp()));
        account.setCoin(data.getCoin());
        account.setDiamond(data.getDiamond());
        account.setIdentify(data.getIdentify());
        account.setTotalRecharge(data.getTotalRecharge());
        account.setValidDiamond(data.getValidDiamond());
        account.setLimit(data.getLimit());
        account.setCard1(data.getCard1());
        account.setCard2(data.getCard2());
        account.setCard3(data.getCard3());

        SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

        account.setLastUpTime(df.format(System.currentTimeMillis()));


        return accountillegalMapper.insert(account);
    }


}
